package com.dragon.repository.domain.dto;

import com.dragon.repository.entity.VendorProducts;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class VendorProductsDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    private Integer id;

    @ApiModelProperty(value = "产品名称")
    private String name;

    @ApiModelProperty(value = "单位")
    private Integer unit;

    @ApiModelProperty(value = "单价")
    private BigDecimal onePrice;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "规格型号")
    private String specification;

    @ApiModelProperty(value = "材质")
    private String material;

    @ApiModelProperty(value = "单位名称")
    private String unitName;


    public VendorProductsDTO() {}

    public VendorProductsDTO(VendorProducts entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static VendorProductsDTO convert(VendorProducts entity) {
        return new VendorProductsDTO(entity);
    }

    public static List<VendorProductsDTO> convertList(List<VendorProducts> list) {
        List<VendorProductsDTO> resultList = new ArrayList<>();
        for (VendorProducts entity : list) {
            resultList.add(new VendorProductsDTO(entity));
        }
        return resultList;
    }}
